<?php
namespace app\example\controller;

use app\common\controller\Front;

class Captcha extends Front
{
    public function _initialize()
    {
        parent::_initialize();
    }
    
    public function index()
    {
        //定义模板表单变量
        $this->assign('forms',[
            'name'     => 'example/captcha/index',
            'class'    => 'bg-white',
            'action'   => DcUrl('example/captcha/save'),
            'method'   => 'post',
            'submit'   => lang('submit'),
            'reset'    => lang('reset'),
            'close'    => false,
            'ajax'     => false,
            'disabled' => false,
            'callback' => false,
            'data'     => false,
            'items'    => DcFormItems([
                'captcha' => [
                    'type'        => 'captcha',
                    'required'    => true,
                    'style'       => 'max-width:145px',
                    'class'       => 'form-group row',
                    'class_left'  => 'col-12 d-none',
                    'class_right' => 'col-12',
                    'class_right_control' => 'form-control',
                ],
            ]),
        ]);
        //加载模板
        return $this->fetch();
    }
    
    public function save()
    {
        return $this->success('ok');
    }
}